package org.ngrinder.model;

import static org.ngrinder.common.util.AccessUtils.getSafe;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;

import org.ngrinder.model.BaseModel;
import org.ngrinder.model.Cloneable;
import org.ngrinder.model.User;

import com.google.gson.annotations.Expose;


@SuppressWarnings({"JpaDataSourceORMInspection", "UnusedDeclaration", "JpaAttributeTypeInspection"})
@Entity
@Table(name = "ND_TESTREQUIREMENT")
public class TestRequirement extends BaseModel<TestRequirement> {

	private static final long serialVersionUID = -974196200920430904L;

	public TestRequirement() {

	}
	
	/**
	 * Constructor.
	 *
	 * @param createdUser crested user.
	 */
	public TestRequirement(User createdUser) {
		this.setCreatedUser(createdUser);
	}
	
	@Expose
	@Cloneable
	@Column(name = "project_name")
	private String projectName;
	
	@Expose
	@Cloneable
	@Column(name = "project_name_cn")
	private String projectNameCn;
	
	@Expose
	@Cloneable
	@Column(name = "ver")
	private String ver;
	
	@Expose
	@Cloneable
	@Column(name = "test_prupose")
	private String testPrupose;
	
	
	@Expose
	@Cloneable
	@Column(name = "test_info")
	private String testInfo;
	
	@Expose
	@Cloneable
	@Column(name = "test_files")
	private String testFiles;
	
	@Expose
	@Cloneable
	@Column(name = "test_env")
	private String testEnv;
	
	@Expose
	@Cloneable
	@Column(name = "test_env_info")
	private String testEnvInfo;
	
	@Expose
	@Cloneable
	@Column(name = "vuser")
	private String vuser;
	
	@Expose
	@Cloneable
	@Column(name = "responsetime")
	private String responsetime;
	
	@Expose
	@Cloneable
	@Column(name = "succ_rate")
	private String succRate;
	
	@Expose
	@Cloneable
	@Column(name = "test_info_list")
	private String testInfoList;
	
	@Expose
	@Cloneable
	@Column(name = "requireman")
	private String requireman;
	
	@Expose
	@Cloneable
	@Column(name = "peoples")
	private String peoples;
	
	@Expose
	@Cloneable
	@Column(name = "date")
	private String date;
	
	@Expose
	@Cloneable
	@Column(name = "testResult")
	private String testResult;
	
	@Expose
	@Cloneable
	@Column(name = "testLevel")
	private String testLevel;
	
	@Expose
	@Cloneable
	@Column(name = "hasTestData")
	private Integer hasTestData;
	
	

	public String getTestResult() {
		return testResult;
	}

	public void setTestResult(String testResult) {
		this.testResult = testResult;
	}

	public String getTestLevel() {
		return testLevel;
	}

	public void setTestLevel(String testLevel) {
		this.testLevel = testLevel;
	}

	public int getHasTestData() {
		return hasTestData;
	}

	public void setHasTestData(int hasTestData) {
		this.hasTestData = hasTestData;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getVer() {
		return ver;
	}

	public void setVer(String ver) {
		this.ver = ver;
	}

	public String getTestPrupose() {
		return testPrupose;
	}

	public void setTestPrupose(String testPrupose) {
		this.testPrupose = testPrupose;
	}

	public String getTestInfo() {
		return testInfo;
	}

	public void setTestInfo(String testInfo) {
		this.testInfo = testInfo;
	}

	public String getTestFiles() {
		return testFiles;
	}

	public void setTestFiles(String testFiles) {
		this.testFiles = testFiles;
	}

	public String getTestEnv() {
		return testEnv;
	}

	public void setTestEnv(String testEnv) {
		this.testEnv = testEnv;
	}

	public String getTestEnvInfo() {
		return testEnvInfo;
	}

	public void setTestEnvInfo(String testEnvInfo) {
		this.testEnvInfo = testEnvInfo;
	}

	public String getVuser() {
		return vuser;
	}

	public void setVuser(String vuser) {
		this.vuser = vuser;
	}

	public String getResponsetime() {
		return responsetime;
	}

	public void setResponsetime(String responsetime) {
		this.responsetime = responsetime;
	}

	public String getSuccRate() {
		return succRate;
	}

	public void setSuccRate(String succRate) {
		this.succRate = succRate;
	}

	public String getTestInfoList() {
		return testInfoList;
	}

	public void setTestInfoList(String testInfoList) {
		this.testInfoList = testInfoList;
	}

	public String getRequireman() {
		return requireman;
	}

	public void setRequireman(String requireman) {
		this.requireman = requireman;
	}

	public String getPeoples() {
		return peoples;
	}

	public void setPeoples(String peoples) {
		this.peoples = peoples;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}
		
	public String getProjectNameCn() {
		return projectNameCn;
	}

	public void setProjectNameCn(String projectNameCn) {
		this.projectNameCn = projectNameCn;
	}

	@PrePersist
	@PreUpdate
	public void init() {
		this.projectName = getSafe(this.projectName, "");
		this.projectNameCn = getSafe(this.projectNameCn, "");
		this.ver = getSafe(this.ver, "");
		this.testPrupose = getSafe(this.testPrupose, "");
		this.testInfo = getSafe(this.testInfo, "");
		this.testFiles = getSafe(this.testFiles, "");
		this.testEnv = getSafe(this.testEnv, "");
		this.testEnvInfo = getSafe(this.testEnvInfo, "");
		this.vuser = getSafe(this.vuser, "");
		this.responsetime = getSafe(this.responsetime, "");
		this.succRate = getSafe(this.succRate, "");
		this.testInfoList = getSafe(this.testInfoList, "");
		this.requireman = getSafe(this.requireman, "");
		this.peoples = getSafe(this.peoples, "");
		this.date = getSafe(this.date, "");
		this.hasTestData = getSafe(this.hasTestData, 0);
		this.testResult = getSafe(this.testResult, "");
		this.testLevel = getSafe(this.testLevel, "");
	}
	
}
